
import { useCache } from "@/hooks/useCache";
const { wsCache } = useCache('localStorage');

export const getItem = (name: string) => {
  const data: any = wsCache.get(name);
  try {
    return JSON.parse(data);
  } catch (error) {
    return data;
  }
};
export const setItem = (name: string, value: any) => {
  if (typeof value === "object") {
    value = JSON.stringify(value);
  }
  wsCache.set(name, value);
};
export const removeItem = (name: string) => {
  wsCache.delete(name);
};
